﻿using System;

namespace SDL
{
	public abstract class TimeSelector
	{
		protected TimeSpan myTimeSpan;

		internal int ReferenceValue
		{
			set 
			{
				myTimeSpan = MyTimeSpan(value); 
			}
		}

		public DateTime Ago 
		{ 
			get 
			{ 
				return( DateTime.Now - myTimeSpan); 
			} 
		}

		public DateTime FromNow 
		{ 
			get 
			{ 
				return( DateTime.Now + myTimeSpan); 
			} 
		}

		public DateTime AgoSince(DateTime dt) 
		{ 
			return (dt - myTimeSpan); 
		}

		public DateTime From(DateTime dt) 
		{ 
			return (dt + myTimeSpan);
		}

		protected abstract TimeSpan MyTimeSpan(int refValue);
	}
}
